import request from '@/request'
import {C2B} from '@/utils/wordtransfer.js'

// 查询搜索并分页
export const findAdminChannels = (data) => {
    return request.post("/channel/list",data)
}

// 回收站
export const findAdminChannelsRecyle = (data) => {
    return request.post("/channel/recyle",data)
}

// 保存和更新
export const saveUpdateAdminChannel = (data) => {
    return request.post("/channel/saveupdate",data)
}

// 根据id查询
export const getAdminChannelById = (id) => {
    return request.post(`/channel/get/${id}`,{})
}

// 根据id删除 --逻辑删除
export const deleteAdminChannelById = (id) => {
    return request.post(`/channel/del/${id}`,{})
}

// 恢复删除
export const recoverByIdAdminChannel = (id) => {
    return request.post(`/channel/recover/${id}`,{})
}

// 批量逻辑删除
export const bacthDeletesAdminChannel = (ids) => {
    return request.post(`/channel/batch/dels`,{ids})
}

// 批量恢复
export const batchRecoversAdminChannel = (ids) => {
    return request.post(`/channel/batch/recover`,{ids})
}

// 根据id删除 --逻辑删除
export const removeAdminChannelById = (id) => {
    return request.post(`/channel/remove/${id}`,{})
}

// 批量物理删除
export const batchRemovesAdminChannel = (ids) => {
    return request.post(`/channel/batch/remove`,{ids})
}

// 修改状态
export const updateStatus = (id,field,value) => {
    field = C2B(field)
    return request.post(`/channel/status/${id}/${field}?value=${value}`,{})
}

// 复制
export const copyData = (id) => {
    return request.post(`/channel/copy/${id}`, {})
}